﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpSphinx.Frontend
{
    public class FrontEnd : BaseDataProcessor 
    {
        public static String Prop_Pipeline = "Pipeline";

        private List<IDataProcessor> frontEndList;


        private IDataProcessor First;
        private IDataProcessor Last;
        private List<ISignalListener> signalListener = new List<ISignalListener>();

        public FrontEnd()
        {

        }

        public FrontEnd(List<IDataProcessor> FrontEndList)
        {

            this.frontEndList = FrontEndList;
        }


        private void init()
        {
            Last = null;

            foreach (IDataProcessor dp in frontEndList)
            {
                if (Last != null)
                    dp.setPredecessor(Last);


                if (First == null)
                {
                    First = dp;
                }
                
                Last = dp; 
            }
            initalize();

        }

        public override void initalize()
        {
            base.initalize();
            foreach (IDataProcessor dp in frontEndList)
            {
                dp.Initialize();
            }
        }
        


    }
}
